#pragma once
#include <functional>
#include <pthread.h>

class HiThread {
public:
    typedef std::function<void()> RUN_FUN;
public:
    HiThread();
public:
    void start(const RUN_FUN& fun);
    void stop();
    bool want_exit();
public:
    void run();
private:
    bool on_thread;
    bool is_exit;
    pthread_t thread;
    RUN_FUN run_fun;
};